package com.lingshi.shopping_search_service.rocketmq;


import cn.hutool.log.Log;
import com.lingshi.shopping.constant.Constant;
import com.lingshi.shopping.entity.GoodsDesc;
import com.lingshi.shopping.service.SearchService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RocketMQMessageListener(topic= Constant.DELETE_GOODS_TOPIC,consumerGroup = Constant.DELETE_GOODS_CONSUMER_GROUP )
public class DeleteGoodsConsumer implements RocketMQListener<Long> {

    @Autowired
    private SearchService searchService;

    @Override
    public void onMessage(Long goodsId) {
        log.info("======删除商品====");
        log.info("{}",goodsId);
        searchService.delete(goodsId);

    }
}
